package cre.spring.javaconfig2;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;

/**
 * @Author guchenbo
 * @Date 2019/4/20.
 */
@ComponentScan("cre.spring.javaconfig2")
public class AppBoot {
    public static void main(String[] args) {
        ApplicationContext context =
                        // new AnnotationConfigApplicationContext();
//((AnnotationConfigApplicationContext) context).register(JavaConfig.class);
//        ((AnnotationConfigApplicationContext) context).refresh();
                        new AnnotationConfigApplicationContext(AppBoot.class);

//                        ((AnnotationConfigApplicationContext) context).refresh();
        Foo foo = context.getBean("foo", Foo.class);
        foo.say();

    }
}
